home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / totsrc11.zip / TOTLIST.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-08  |  56KB  |  2,065 lines

  1. {               Copyright 1991 TechnoJock Software, Inc.               }
  2. {                          All Rights Reserved                         }
  3. {                         Restricted by License                        }
  4.  
  5. {                             Build # 1.10e                            }
  6.  
  7. Unit totLIST;
  8. {$I TOTFLAGS.INC}
  9.  
  10. {
  11.  Development Notes:
  12.      1.00a   4/03/91   Corrected Dispose problem in BrowseFileOBJ when
  13.                        file not found.
  14.      1.00b   5/06/91   Added close statement in AssignFile
  15.      1.00c   5/09/91   Added GetSelectedPick to ListOBJ
  16.      1.00d   5/23/91   Added reaction to Mouse method 1
  17.      1.00e   5/28/91   Initialized vActiveDir in ReadFiles
  18.      1.00f   5/30/91   Changed allow toggle logic for String arrays
  19.      1.00g   7/15/91   Added SetChangeDir to ListDirOBJ
  20.      1.00h  10/03/91   Added a char hook to ListDirOBJ
  21.      1.00i  11/06/91   Changed memory checking in ListArrayOBJ.AssignList
  22.      1.00j  01/16/91   Corrected range check error on scroll bar
  23.      1.00k  10/02/92   Changed ReadFiles when path/drive specified
  24.      1.10a  02/23/93   Corrected filemask problem introduced in 1.00k
  25.      1.10b  04/13/93   Changed AssignFile retcode to 2 when no memory
  26.      1.10c  05/03/93   Initialized vLastKey in ListOBJ.Init
  27.                        & Added ListLinkOBJ.RefreshList
  28.                        & Changed Individual Item Selection to Double Click
  29.      1.10d  05/14/93   Corrected Total File Count when FillList called
  30.      1.10e  06/06/93   Wait for mouse release on Double Click
  31. }
  32. INTERFACE
  33.  
  34. Uses DOS,
  35.      totSYS, totLOOK, totFAST, totWIN, totINPUT, totLINK, totSTR, totIO1;
  36.  
  37. TYPE
  38. tListAction = (Finish,Refresh,None);
  39. ListCharFunc = function(var K:word; var X,Y: byte; HiPick:longint): tListAction;
  40. ListMsgFunc = function(HiPick:longint):string;
  41.  
  42. pBrowseOBJ = ^BrowseOBJ;
  43. BrowseOBJ = object
  44.    vWin: StretchWinPtr;
  45.    vTopPick: longint;         {number of first pick in window}
  46.    vTotPicks: longint;        {total number of picks}
  47.    vListVisible: boolean;     {is list on display}
  48.    vListAssigned: boolean;    {is data assigned to list}
  49.    vActivePick: integer;      {the offset of the active pick from the top}
  50.    vRows: integer;            {total number of visible rows}
  51.    vStartCol : longint;       {string position of first character}
  52.    vEndCol: longint;          {rightmost column for scrolling}
  53.    vRealColWidth: byte;       {max avail column width}
  54.    vLastKey: word;            {last key the user pressed}
  55.    {methods ...}
  56.    constructor Init;
  57.    procedure   SetTopPick(TopPick: longint);
  58.    procedure   SetStartCol(Column: longint);
  59.    procedure   SetEndCol(Column: longint);
  60.    function    Win:StretchWinPtr;
  61.    procedure   DisplayPick(Pick:integer);
  62.    procedure   DisplayAllPicks;
  63.    procedure   ScrollUp;
  64.    procedure   ScrollDown;
  65.    procedure   ScrollPgUp;
  66.    procedure   ScrollPgDn;
  67.    procedure   ScrollFirst;
  68.    procedure   ScrollLast;
  69.    procedure   SlideLeft;
  70.    procedure   SlideRight;
  71.    procedure   ScrollFarRight;
  72.    procedure   ScrollFarLeft;
  73.    procedure   ScrollJumpH(X,Y:byte);
  74.    procedure   ScrollJumpV(X,Y:byte);
  75.    function    LastKey: word;
  76.    procedure   Remove;
  77.    procedure   Show;
  78.    procedure   ResetDimensions;
  79.    procedure   Go;
  80.    function    GetString(Pick, Start,Finish: longint):string;  VIRTUAL;
  81.    destructor  Done;                                           VIRTUAL;
  82. end; {BrowseOBJ}
  83.  
  84. pBrowseArrayOBJ = ^BrowseArrayOBJ;
  85. BrowseArrayOBJ = Object (BrowseOBJ)
  86.    vArrayPtr: pointer;
  87.    vStrLength: byte;
  88.    {methods ...}
  89.    constructor Init;
  90.    procedure   AssignList(var StrArray; Total:Longint; StrLength:byte);
  91.    function    GetString(Pick, Start,Finish:longint): string;  VIRTUAL;
  92.    destructor  Done;                                           VIRTUAL;
  93. end; {BrowseArrayOBJ}
  94.  
  95. pBrowseLinkOBJ = ^BrowseLinkOBJ;
  96. BrowseLinkOBJ = Object (BrowseOBJ)
  97.    vLinkList: ^DLLOBJ;
  98.    {methods ...}
  99.    constructor Init;
  100.    procedure   AssignList(var LinkList: DLLOBJ);
  101.    function    ListPtr: DLLPtr;
  102.    function    GetString(Pick, Start,Finish:longint): string;  VIRTUAL;
  103.    destructor  Done;    VIRTUAL;
  104. end; {BrowseLinkOBJ}
  105.  
  106. pBrowseFileOBJ = ^BrowseFileOBJ;
  107. BrowseFileOBJ = Object (BrowseOBJ)
  108.    vStrList: ^StrDLLOBJ;
  109.    {methods ...}
  110.    constructor Init;
  111.    function    AssignFile(Filename: string):integer;
  112.    function    ListPtr: StrDLLPtr;
  113.    function    GetString(Pick, Start,Finish:longint): string;  VIRTUAL;
  114.    destructor  Done;    VIRTUAL;
  115. end; {BrowseFileOBJ}
  116.  
  117. pListOBJ = ^ListOBJ;
  118. ListOBJ = object
  119.    vWin: StretchWinPtr;       {pointer to a window}
  120.    vMargin: tByteCoords;      {padding around window border}
  121.    vZone: tByteCoords;        {outer window dimensions}
  122.    vTopPick: longint;         {number of first pick in window}
  123.    vTotPicks: longint;        {total number of picks}
  124.    vAllowToggle: boolean;     {can user select items in list}
  125.    vListVisible: boolean;     {is list on display}
  126.    vListAssigned: boolean;    {is data assigned to list}
  127.    vLastChar: word;           {last key user pressed}
  128.    vColWidth: byte;           {user set column width in list display: 0 = max}
  129.    vNAttr: byte;              {normal attribute/color}
  130.    vSAttr: byte;              {attribute for special items}
  131.    vHAttr: byte;              {highlighted topic attribute/color}
  132.    vActivePick: integer;      {the offset of the active pick from the top}
  133.    vRows: integer;            {total number of visible rows}
  134.    vCols: integer;            {Total number of visible columns}
  135.    vRealColWidth: byte;       {max avail column width}
  136.    vLastColWidth: byte;       {width of right most column}
  137.    vUseLastCol: boolean;      {use the last column for highlighting or too narrow}
  138.    vLastKey: word;            {last key the user pressed}
  139.    vCharHook: ListCharFunc;   {character hook}
  140.    vMsgHook: ListMsgFunc;     {message hook}
  141.    vMsgActive: boolean;       {is Msg hook enabled}
  142.    vDualColors: boolean;      {should list use SAttr and NAttr}
  143.    {methods ...}
  144.    constructor Init;
  145.    procedure   SetTopPick(TopPick: longint);
  146.    procedure   SetActivePick(ThePick: LongInt);
  147.    procedure   SetTagging(On:boolean);
  148.    procedure   SetColors(HAttr,NAttr,SAttr: byte);
  149.    procedure   SetColWidth(Wid: byte);
  150.    procedure   SetCharHook(Func:ListCharFunc);
  151.    procedure   SetMsgHook(Func:ListMsgFunc);
  152.    procedure   SetMsgState(On:boolean);
  153.    procedure   SetDualColors(On:Boolean);
  154.    function    GetHiString:string;
  155.    function    GetSelectedPick: longint;
  156.    function    Win:StretchWinPtr;
  157.    procedure   ResetDimensions;
  158.    procedure   DisplayPick(Pick:integer; Hi:boolean);
  159.    procedure   DisplayAllPicks;
  160.    procedure   RefreshList;
  161.    procedure   Remove;
  162.    procedure   ValidateActivePick;
  163.    procedure   ScrollUp;
  164.    procedure   ScrollDown;
  165.    procedure   JumpEngine(Tot, NewValue: longint);
  166.    procedure   ScrollJumpV(X,Y:byte);
  167.    procedure   ScrollJumpH(X,Y:byte);
  168.    procedure   ScrollLeft;
  169.    procedure   ScrollFarLeft;
  170.    procedure   ScrollRight;
  171.    procedure   ScrollFarRight;
  172.    procedure   ScrollPgDn;
  173.    procedure   ScrollPgUp;
  174.    procedure   ScrollFirst;
  175.    procedure   ScrollLast;
  176.    procedure   ToggleSelect;
  177.    function    TargetPick(X,Y:byte): Integer;
  178.    procedure   MouseChoose(KeyX,KeyY:byte);
  179.    function    LastKey: word;
  180.    procedure   Go;
  181.    procedure   Show;
  182.    function    CharTask(var K:word; var X,Y: byte; 
  183.                         HiPick:longint): tListAction;          VIRTUAL;
  184.    function    MessageTask(HiPick:longint):string;             VIRTUAL;
  185.    function    GetString(Pick, Start,Finish:longint): string;  VIRTUAL;
  186.    function    GetStatus(Pick:longint;BitPos:byte): boolean;   VIRTUAL;
  187.    procedure   SetStatus(Pick:longint;BitPos:byte;On:boolean); VIRTUAL;
  188.    procedure   TagAll(On:boolean);                             VIRTUAL;
  189.    destructor  Done;                                           VIRTUAL;
  190. end; {ListOBJ}
  191.  
  192. pListArrayOBJ = ^ListArrayOBJ;
  193. ListArrayOBJ = object (ListOBJ)
  194.    vArrayPtr: pointer;
  195.    vStrLength: byte;
  196.    vLinkList: ^DLLOBJ;
  197.    {methods